﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OtherDevice;
using MotionIoLib;


namespace OtherDevice
{
    [Description("Plasma控制")]
    public partial class PlasmaCtrl:UserControl
    {
        PlasmaPowerBase plasma;
        public PlasmaCtrl()
        {
            InitializeComponent();
        }
        public void FlushToDlg(PlasmaPowerBase plasmaBase, Control father = null)
        {
            try
            {
                if (plasmaBase == null)
                    return;
                if (father != null)
                    this.Location = new Point(father.Location.X, father.Location.Y);
                plasma = plasmaBase;
                this.Dock = DockStyle.Fill;
                this.Show();
            }
            catch (Exception)
            {

                throw;
            }
        }
        private void btn_OpenPlasma_Click(object sender, EventArgs e)
        {
            plasma.Open();
        }

        private void btn_ClosePlasma_Click(object sender, EventArgs e)
        {
            plasma.Close();
        }

        private void btn_GetAlarm_Click(object sender, EventArgs e)
        {
            string ex = "";

            if (!plasma.GetAlarm(ref ex))
            {
                MessageBox.Show(ex);
            }
            else
            {
                MessageBox.Show("无报警");
            }
        }

        private void PlasmaCtrl_Load(object sender, EventArgs e)
        {

        }

        private void btn_GetAllData_Click(object sender, EventArgs e)
        {
            int Power = 0;
            int Air = 0;
            plasma.GetPowerAndAir(ref Power, ref Air);
            lb_Power.Text = $"{Power}";
            lb_AirValue.Text = $"{Air}";
            //textBox3.Text = $"速度:{MotionMgr.GetInstace().GetAxisSpeed(dospT.AxisX, (int)SpeedType.Mid)}";
            //textBox4.Text = $"{ParamSetMgr.GetInstance().GetIntParam("镜头清洗圈数")}";
            //textBox5.Text = $"{dospT.GetStationPointDic()[$"镜头清洗高度"].pointZ}";
            //textBox6.Text = $"{dospT.GetStationPointDic()[$"前盖清洗高度"].pointZ}";

        }
    }
}
